/*****************************************************************************
 *
 *                      HUSONG PROPRIETARY INFORMATION
 *
 *          The information contained herein is proprietary to HUSONG
 *           and shall not be reproduced or disclosed in whole or in part
 *                    or used for any design or manufacture
 *              without direct written authorization from HUSONG.
 *
 *            Copyright (c) 2015 by HUSONG.  All rights reserved.
 *
 *****************************************************************************/
package me.send.data.service.mapper;

import java.util.List;
import java.util.Map;

import me.send.data.service.pojo.Version;
import me.send.data.service.pojo.VersionBean;
import me.send.data.service.provider.VersionProvider;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

/**
 * @author maxmin
 *
 * @date 2015年9月25日 下午4:05:42
 */
public interface VersionMapper {
	
	@Select(value="SELECT v.version_id versionId,version_code versionCode,description,url "
			+ "FROM version WHERE type=#{type} ORDER BY version_id LIMIT 1")
	public Version getVersionByType(int type);
	
	@Select(value="SELECT * "
			+ "FROM version WHERE version_id=#{version_id} ORDER BY version_id LIMIT 1")
	public VersionBean getVersionById(int version_id);
	
	@Update("update version set version_code=#{version_code},type=#{type},updatetime=#{updatetime}"
			+ ",url=#{url},description=#{description} where version_id=#{version_id}")
	public void update(VersionBean version);
	
	@SelectProvider(method = "list", type = VersionProvider.class)	
    public abstract List<VersionBean> list(Map<String,Object> param);
    @SelectProvider(method = "count", type = VersionProvider.class)	
    public abstract Integer count(Map<String,Object> param);
	
	
}
